package com.design.patterns.list.bridge;

/**
 * @author Wangzhiwen
 */
public class BridgeClient {

    public static void main(String[] args) {
        // 手机品牌
        Brand brand = new HuaWei();
        // 手机
        Phone phone = new AlmostPhone(brand);
        // 手机完整的功能
        phoneMethod(phone);
        // 不换品牌换手机样式
        phone = new FoldedPhone(brand);
        phoneMethod(phone);
        // 换品牌不换手机样式
        phone.setBrand(new Vivo());
        phoneMethod(phone);
        // 换品牌换手机样式
        phone = new AlmostPhone(new HuaWei());
        phoneMethod(phone);
    }

    private static void phoneMethod(Phone phone){
        phone.open();
        phone.call();
        phone.close();
    }

}
